import { defineStore } from "pinia";

import {
  getCategoryAddressSale,
  getCategoryGoodsCount,
  getCategoryGoodsFavor,
  getCategoryGoodsSale,
} from "@/service/api/echartGoods";

const useEchartStore = defineStore("echart", {
  state: () => {
    return {
      categoryGoodsSale: [],
      categoryGoodsCount: [],
      categoryGoodsFavor: [],
      addressGoodsSale: [],
    };
  },
  actions: {
    async getCategoryAction() {
      const categoryAddressSale = await getCategoryAddressSale();
      this.addressGoodsSale = categoryAddressSale.data;

      const categoryGoodsCount = await getCategoryGoodsCount();
      this.categoryGoodsCount = categoryGoodsCount.data;

      const categoryGoodsFavor = await getCategoryGoodsFavor();
      this.categoryGoodsFavor = categoryGoodsFavor.data;

      const categoryGoodsSale = await getCategoryGoodsSale();
      this.categoryGoodsSale = categoryGoodsSale.data;
    },
  },
  getters: {},
});

export default useEchartStore;
